load("//ReactNative:DEFS.bzl", "rn_xplat_cxx_library", "FBJNI_TARGET", "ANDROID_JSC_DEPS", "APPLE_JSC_DEPS", "ANDROID", "IS_OSS_BUILD", "react_native_xplat_target")

rn_xplat_cxx_library(
    name = "jni",
    srcs = glob(["*.cpp"]),
    headers = glob(
        ["*.h"],
    ),
    header_namespace = "",
    compiler_flags = [
        "-Wall",
        "-Werror",
        "-fexceptions",
        "-std=c++1y",
        "-frtti",
    ],
    fbandroid_deps = ANDROID_JSC_DEPS,
    fbobjc_deps = APPLE_JSC_DEPS,
    platforms = ANDROID,
    preprocessor_flags = [
        "-DLOG_TAG=\"PackagerConnectionJNI\"",
        "-DWITH_FBSYSTRACE=1",
        "-DWITH_INSPECTOR=1",
    ],
    soname = "libpackagerconnectionjnifb.$(ext)",
    visibility = [
        "PUBLIC",
    ],
    deps = ([
        FBJNI_TARGET,
        "xplat//folly:molly",
        react_native_xplat_target("jschelpers:jschelpers"),
        react_native_xplat_target("jsinspector:jsinspector"),
    ]) if not IS_OSS_BUILD else [],
)
